package com.seed.commons.util;


public class ValidateFile {
	
	//private static Properties pros = new Properties() ;

	/*static {
		try {
			pros.load(BaseForm.class.getClassLoader().getResourceAsStream("arrowuploadfiletype.properties")) ;
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	*//**
	 * 验证上传文件类型是否属于图片格式
	 * @return
	 *//*
	public static boolean imageType(UploadFileForm fileform) {
		String[] imgType = new String[]{"gif","jpg","bmp","png"};
		
		for(String it : imgType) {
			String value = pros.getProperty(it) ;
			String[] values = value.split(",") ;
			for(String v : values) {
				if(v.equals(fileform.getFileContentType())) return true ;
			}
		}
		return false ;
	}
	
	*//**
	 * 验证上传文件是否属于图片/flash动画/word文件/exe文件/pdf文件/TxT文件/xls文件/ppt文件
	 * @return
	 *//*
	public static boolean fileType(UploadFileForm fileform) {
		String[] fileType = new String[]{"swf","doc","txt","xls","ppt","pdf","exe"};
		
		for(String ft : fileType) {
			String value = pros.getProperty(ft) ;
			String[] values = value.split(",") ;
			for(String v : values) {
				if(v.equals(fileform.getFileContentType())) return true ;
			}
		}
		return false ;
	}
	
	*//** 获得文件后缀 *//*
	public static String getExt(String img) {
		return img.substring(img.lastIndexOf(".")+1).toLowerCase() ;
	}
	
	public static void main(String[] args) {
		UploadFileForm u = new UploadFileForm() ;
		u.setFileContentType("application/pdf") ;
		u.setFileFileName("12345.pdf") ;
		System.out.println(fileType(u));
	}*/
	
	
}
